<!DOCTYPE html>
<!--
Copyright (c) 2003-2016, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.md or http://ckeditor.com/license
-->
<html>
<head>
    <meta charset="utf-8">
    <title>CKEditor Sample</title>
    <script src="../ckeditor.js"></script>
    <script src="js/sample.js"></script>
    <script src="js/jquery.min.js"></script>
    <script src="../../css/bootstrap.min.css"></script>
    <script src="../../js/config.js"></script>
    <link rel="stylesheet" href="css/samples.css">
    <link rel="stylesheet" href="toolbarconfigurator/lib/codemirror/neo.css">
    <style>

        .content{
            margin: 0 auto;
            width: 800px;
        }
    </style>
</head>
<body>
<header>
    <div style="height: 50px;width: 100%;background-image: url(img/top_back.png);">
        &nbsp;&nbsp;&nbsp;&nbsp;<img src="img/logos.png">
    </div>
    <h1 align="center">环保知识发布</h1>
</header>

<main style="  background-color: #f9f9f9;">

    <div class="content">
        <form class="form-horizontal" method="post" action="http://localhost:8099/news" enctype="multipart/form-data">
            <div class="form-group">

                <div class="col-sm-10">
                    <label for="title" class="col-sm-2">标题:</label>
                    <input type="text" name="title" id="title" style="width: 700px"/>
                </div>
            </div>
            <br/>
            <div class="form-group">

                <div class="col-sm-10">
                    <label for="author" class="control-label">作者:</label>
                    <input type="text" name="author" id="author"/>
                </div>
            </div>
            <br/>
            <div class="form-group">
                <table>
                    <tr>
                        <td><label for="introduce" >简介:</label></td>
                        <td> <textarea name="introduce" rows="3" id="introduce" style="width: 700px;"></textarea></td>
                    </tr>
                </table>



            </div>
            <br/>

            <div class="form-group">
                <div class="col-sm-10">
                    <label for="introduceImg" class="control-label">展示图片:</label>
                    <input type="file" name="introduceImg" id="introduceImg">
                </div>
            </div>

            <br/>
            <textarea name="editor" id="editor"></textarea>
            <input type="hidden" name="filetype" id="filetype">
            <br/>
            <div class="form-group">

                <div class="col-sm-10">
                    <label for="newsclass" class="control-label">分类:</label>
                    <select class="form-control" id="newsclass" name="newsclass">
                        <option value="原创">原创</option>
                        <option value="转载">转载</option>
                    </select>
                    <input type="hidden" name="classname" id="classname">
                </div>
            </div>
            <br/>
            <div class="form-group">
                <input type="submit" name="发布" value="发布" onclick="change()">
            </div>



        </form>

    </div>
</main>

<footer class="footer-a grid-container">

</footer>

<script>

    initSample();


    var newsclass = $.parseJSON(environmentalClass);

    var select = $('#newsclass');
    select.empty();
    var ope = "";
    $.each(newsclass,function(i,item){
        ope+= '<option value="'+item.id+'">'+item.name+'</option>'
    });
    select.append(ope);




    function change(){
        $('#classname').val($("#newsclass").find("option:selected").text());
        var  type = document.getElementById("introduceImg").value.split('.');
        document.getElementById("filetype").value = type[type.length-1];
    }
</script>

</body>
</html>
